<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: Sifteo::StoredObject Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>Sifteo</b></li><li class="navelem"><a class="el" href="class_sifteo_1_1_stored_object.html">StoredObject</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="class_sifteo_1_1_stored_object-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Sifteo::StoredObject Class Reference<div class="ingroups"><a class="el" href="group__filesystem.html">Filesystem</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>A lightweight ID for a persistently stored object.  
 <a href="class_sifteo_1_1_stored_object.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="filesystem_8h_source.html">sifteo/filesystem.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ab156f27919a9ffe4502af21322a4b2bc"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab156f27919a9ffe4502af21322a4b2bc"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#ab156f27919a9ffe4502af21322a4b2bc">erase</a> () const </td></tr>
<tr class="memdesc:ab156f27919a9ffe4502af21322a4b2bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erase this object. Equivalent to a zero-length <a class="el" href="class_sifteo_1_1_stored_object.html#a041e820e61e67ca90bc8ee225b6060bb" title="Save a new version of an object.">write()</a> <br/></td></tr>
<tr class="separator:ab156f27919a9ffe4502af21322a4b2bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ebfedbbbd04d075d0a36bf1b4781e22"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0ebfedbbbd04d075d0a36bf1b4781e22"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a0ebfedbbbd04d075d0a36bf1b4781e22">operator const _SYSObjectKey</a> () const </td></tr>
<tr class="memdesc:a0ebfedbbbd04d075d0a36bf1b4781e22"><td class="mdescLeft">&#160;</td><td class="mdescRight">Implicit conversion to system object. <br/></td></tr>
<tr class="separator:a0ebfedbbbd04d075d0a36bf1b4781e22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97e6a3a014eaf846596222693162ea0f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a97e6a3a014eaf846596222693162ea0f"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a97e6a3a014eaf846596222693162ea0f">operator!=</a> (_SYSObjectKey other) const </td></tr>
<tr class="memdesc:a97e6a3a014eaf846596222693162ea0f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inequality comparison operator. <br/></td></tr>
<tr class="separator:a97e6a3a014eaf846596222693162ea0f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c7debc516198f7d0e00aabd5359512d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6c7debc516198f7d0e00aabd5359512d"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a6c7debc516198f7d0e00aabd5359512d">operator==</a> (_SYSObjectKey other) const </td></tr>
<tr class="memdesc:a6c7debc516198f7d0e00aabd5359512d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equality comparison operator. <br/></td></tr>
<tr class="separator:a6c7debc516198f7d0e00aabd5359512d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a753f6a27739f8dcf5aa2c898979e637d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a753f6a27739f8dcf5aa2c898979e637d">read</a> (void *buffer, unsigned bufferSize, _SYSVolumeHandle volume=0) const </td></tr>
<tr class="memdesc:a753f6a27739f8dcf5aa2c898979e637d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a stored object into memory.  <a href="#a753f6a27739f8dcf5aa2c898979e637d">More...</a><br/></td></tr>
<tr class="separator:a753f6a27739f8dcf5aa2c898979e637d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a66b6325773616d8442172db7bbfa6b7d"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a66b6325773616d8442172db7bbfa6b7d"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a66b6325773616d8442172db7bbfa6b7d">read</a> (T &amp;buffer, _SYSVolumeHandle volume=0) const </td></tr>
<tr class="memdesc:a66b6325773616d8442172db7bbfa6b7d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Template wrapper for <a class="el" href="class_sifteo_1_1_stored_object.html#a753f6a27739f8dcf5aa2c898979e637d" title="Read a stored object into memory.">read()</a> of fixed-size objects.  <a href="#a66b6325773616d8442172db7bbfa6b7d">More...</a><br/></td></tr>
<tr class="separator:a66b6325773616d8442172db7bbfa6b7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a764859c5bdc13a30acd5733f355a340c"><td class="memTemplParams" colspan="2"><a class="anchor" id="a764859c5bdc13a30acd5733f355a340c"></a>
template&lt;typename T &gt; </td></tr>
<tr class="memitem:a764859c5bdc13a30acd5733f355a340c"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a764859c5bdc13a30acd5733f355a340c">readObject</a> (T &amp;buffer, _SYSVolumeHandle volume=0) const </td></tr>
<tr class="memdesc:a764859c5bdc13a30acd5733f355a340c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Template wrapper for <a class="el" href="class_sifteo_1_1_stored_object.html#a753f6a27739f8dcf5aa2c898979e637d" title="Read a stored object into memory.">read()</a> of fixed-size objects. <br/></td></tr>
<tr class="separator:a764859c5bdc13a30acd5733f355a340c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52e0318a54610cf4a302bf80325ad077"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a52e0318a54610cf4a302bf80325ad077"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a52e0318a54610cf4a302bf80325ad077">StoredObject</a> (_SYSObjectKey k)</td></tr>
<tr class="memdesc:a52e0318a54610cf4a302bf80325ad077"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize from a system object. <br/></td></tr>
<tr class="separator:a52e0318a54610cf4a302bf80325ad077"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6beec358463c3f08eeea605966f95c08"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6beec358463c3f08eeea605966f95c08"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a6beec358463c3f08eeea605966f95c08">StoredObject</a> (int k)</td></tr>
<tr class="memdesc:a6beec358463c3f08eeea605966f95c08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize from an integer. <br/></td></tr>
<tr class="separator:a6beec358463c3f08eeea605966f95c08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5b59dc737e0a63b4a5234c795f3b9e3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af5b59dc737e0a63b4a5234c795f3b9e3"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#af5b59dc737e0a63b4a5234c795f3b9e3">StoredObject</a> (unsigned k)</td></tr>
<tr class="memdesc:af5b59dc737e0a63b4a5234c795f3b9e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize from an unsigned integer. <br/></td></tr>
<tr class="separator:af5b59dc737e0a63b4a5234c795f3b9e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a041e820e61e67ca90bc8ee225b6060bb"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a041e820e61e67ca90bc8ee225b6060bb">write</a> (const void *data, unsigned dataSize) const </td></tr>
<tr class="memdesc:a041e820e61e67ca90bc8ee225b6060bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a new version of an object.  <a href="#a041e820e61e67ca90bc8ee225b6060bb">More...</a><br/></td></tr>
<tr class="separator:a041e820e61e67ca90bc8ee225b6060bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a772401b125e4898f920ee8e76aa5e6cd"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a772401b125e4898f920ee8e76aa5e6cd"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a772401b125e4898f920ee8e76aa5e6cd">write</a> (const T &amp;buffer) const </td></tr>
<tr class="memdesc:a772401b125e4898f920ee8e76aa5e6cd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Template wrapper for <a class="el" href="class_sifteo_1_1_stored_object.html#a041e820e61e67ca90bc8ee225b6060bb" title="Save a new version of an object.">write()</a> of fixed-size objects.  <a href="#a772401b125e4898f920ee8e76aa5e6cd">More...</a><br/></td></tr>
<tr class="separator:a772401b125e4898f920ee8e76aa5e6cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42b814d79fdd03a479dc0ff4b0d47dba"><td class="memTemplParams" colspan="2"><a class="anchor" id="a42b814d79fdd03a479dc0ff4b0d47dba"></a>
template&lt;typename T &gt; </td></tr>
<tr class="memitem:a42b814d79fdd03a479dc0ff4b0d47dba"><td class="memTemplItemLeft" align="right" valign="top">int&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a42b814d79fdd03a479dc0ff4b0d47dba">writeObject</a> (const T &amp;buffer) const </td></tr>
<tr class="memdesc:a42b814d79fdd03a479dc0ff4b0d47dba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Template wrapper for <a class="el" href="class_sifteo_1_1_stored_object.html#a041e820e61e67ca90bc8ee225b6060bb" title="Save a new version of an object.">write()</a> of fixed-size objects. <br/></td></tr>
<tr class="separator:a42b814d79fdd03a479dc0ff4b0d47dba"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a59d04839bec8308a678d360de5eceeca"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="class_sifteo_1_1_stored_object.html">StoredObject</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a59d04839bec8308a678d360de5eceeca">allocate</a> ()</td></tr>
<tr class="memdesc:a59d04839bec8308a678d360de5eceeca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a unique <a class="el" href="class_sifteo_1_1_stored_object.html" title="A lightweight ID for a persistently stored object.">StoredObject</a> value at compile-time.  <a href="#a59d04839bec8308a678d360de5eceeca">More...</a><br/></td></tr>
<tr class="separator:a59d04839bec8308a678d360de5eceeca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:abc14a56c915a952bd644e0cea23aad0b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abc14a56c915a952bd644e0cea23aad0b"></a>
static const unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#abc14a56c915a952bd644e0cea23aad0b">LIMIT</a> = _SYS_FS_MAX_OBJECT_KEYS - 1</td></tr>
<tr class="memdesc:abc14a56c915a952bd644e0cea23aad0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maximum allowed value for a key (255) <br/></td></tr>
<tr class="separator:abc14a56c915a952bd644e0cea23aad0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a91a58f0e70aed3ff2adc112d8f072e01"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a91a58f0e70aed3ff2adc112d8f072e01"></a>
static const unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_stored_object.html#a91a58f0e70aed3ff2adc112d8f072e01">MAX_SIZE</a> = _SYS_FS_MAX_OBJECT_SIZE</td></tr>
<tr class="memdesc:a91a58f0e70aed3ff2adc112d8f072e01"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maximum size of an object, in bytes (4080) <br/></td></tr>
<tr class="separator:a91a58f0e70aed3ff2adc112d8f072e01"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A lightweight ID for a persistently stored object. </p>
<p>Games may read and write such objects stored in a key-value dictionary associated with their volume. The key space is limited. Valid keys range from 0 to LIMIT. These keys may be allocated manually or automatically.</p>
<p>If you're computing keys dynamically, cast your key to a <a class="el" href="class_sifteo_1_1_stored_object.html" title="A lightweight ID for a persistently stored object.">StoredObject</a> in order to access the object data at that key. If you're allocating keys statically, you can create global <a class="el" href="class_sifteo_1_1_stored_object.html" title="A lightweight ID for a persistently stored object.">StoredObject</a> instances which act as a single place to associate IDs with names.</p>
<p>By default, objects are both read from and written to a store associated with the current game's <a class="el" href="class_sifteo_1_1_volume.html" title="A coarse-grained region of external memory.">Volume</a>. It is possible to read another game's stored data (by specifying its <a class="el" href="class_sifteo_1_1_volume.html" title="A coarse-grained region of external memory.">Volume</a>) but you may not write to another game's object store.</p>
<p>Objects are stored in a journaled filesystem, and writes are synchronous. By design, if power fails or the system is otherwise interrupted during a write, future reads will continue to return the last successfully-written version of an object.</p>
<p>Object sizes must be at least one byte, and no more than MAX_SIZE bytes. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a59d04839bec8308a678d360de5eceeca"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="class_sifteo_1_1_stored_object.html">StoredObject</a> Sifteo::StoredObject::allocate </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Allocate a unique <a class="el" href="class_sifteo_1_1_stored_object.html" title="A lightweight ID for a persistently stored object.">StoredObject</a> value at compile-time. </p>
<p>Every time this function is invoked, it is resolved by the linker to a unique <a class="el" href="class_sifteo_1_1_stored_object.html" title="A lightweight ID for a persistently stored object.">StoredObject</a>. We start allocating at LIMIT, and each successive call to <a class="el" href="class_sifteo_1_1_stored_object.html#a59d04839bec8308a678d360de5eceeca" title="Allocate a unique StoredObject value at compile-time.">allocate()</a> returns a value decremented by one.</p>
<p>This allocation order supports a strategy in which manually-assigned or calculated IDs begin at 0 and count up, and automatically allocated IDs begin at LIMIT and count down. </p>

</div>
</div>
<a class="anchor" id="a753f6a27739f8dcf5aa2c898979e637d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int Sifteo::StoredObject::read </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>bufferSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">_SYSVolumeHandle&#160;</td>
          <td class="paramname"><em>volume</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Read a stored object into memory. </p>
<p>Reads into the provided buffer. Returns the actual number of bytes read, which on success always equals either the size of the stored data for this object or the size of the provided buffer, whichever is smaller.</p>
<p>The provided 'bufferSize' <em>must</em> be large enough to hold the entire stored object, excepting only any trailing 0xFF bytes. It is not, in general, possible to perform partial reads of a stored object.</p>
<p>If no data has been stored for this object yet, returns zero. Note that the object store does not distinguish between zero-length values and missing values.</p>
<p>By default, this reads from the object store associated with the current game. The optional 'volume' parameter can be set to a specific <a class="el" href="class_sifteo_1_1_volume.html" title="A coarse-grained region of external memory.">Sifteo::Volume</a> instance in order to read objects from a different game's data store.</p>
<dl class="section warning"><dt>Warning</dt><dd>TO DO: Define error codes (&lt; 0) as necessary. </dd></dl>

</div>
</div>
<a class="anchor" id="a66b6325773616d8442172db7bbfa6b7d"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int Sifteo::StoredObject::read </td>
          <td>(</td>
          <td class="paramtype">T &amp;&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">_SYSVolumeHandle&#160;</td>
          <td class="paramname"><em>volume</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Template wrapper for <a class="el" href="class_sifteo_1_1_stored_object.html#a753f6a27739f8dcf5aa2c898979e637d" title="Read a stored object into memory.">read()</a> of fixed-size objects. </p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd>Use <a class="el" href="class_sifteo_1_1_stored_object.html#a764859c5bdc13a30acd5733f355a340c" title="Template wrapper for read() of fixed-size objects.">readObject()</a> instead. This will be removed in a future version update. </dd></dl>

</div>
</div>
<a class="anchor" id="a041e820e61e67ca90bc8ee225b6060bb"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int Sifteo::StoredObject::write </td>
          <td>(</td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>dataSize</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Save a new version of an object. </p>
<p>Replace this object's contents with a new block of data. On success, always returns the number of bytes written, which is always equal to dataSize.</p>
<p>The data block will be padded to the next multiple of 16 bytes.</p>
<p>Writing an empty data block is equivalent to erasing the stored object.</p>
<p>If power fails during a write, by design subsequent reads will return the last successfully-saved version of that object.</p>
<dl class="section warning"><dt>Warning</dt><dd>TO DO: Define error codes (&lt; 0) as necessary. </dd></dl>

</div>
</div>
<a class="anchor" id="a772401b125e4898f920ee8e76aa5e6cd"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int Sifteo::StoredObject::write </td>
          <td>(</td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Template wrapper for <a class="el" href="class_sifteo_1_1_stored_object.html#a041e820e61e67ca90bc8ee225b6060bb" title="Save a new version of an object.">write()</a> of fixed-size objects. </p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000002">Deprecated:</a></b></dt><dd>Use <a class="el" href="class_sifteo_1_1_stored_object.html#a42b814d79fdd03a479dc0ff4b0d47dba" title="Template wrapper for write() of fixed-size objects.">writeObject()</a> instead. This will be removed in a future version update. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="filesystem_8h_source.html">filesystem.h</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
